home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_apache2.idb / usr / freeware / apache2 / include / util_script.h.z / util_script.h
C/C++ Source or Header  |  2002-07-08  |  8KB  |  185 lines

  1. /* ====================================================================
  2.  * The Apache Software License, Version 1.1
  3.  *
  4.  * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  5.  * reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  *
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in
  16.  *    the documentation and/or other materials provided with the
  17.  *    distribution.
  18.  *
  19.  * 3. The end-user documentation included with the redistribution,
  20.  *    if any, must include the following acknowledgment:
  21.  *       "This product includes software developed by the
  22.  *        Apache Software Foundation (http://www.apache.org/)."
  23.  *    Alternately, this acknowledgment may appear in the software itself,
  24.  *    if and wherever such third-party acknowledgments normally appear.
  25.  *
  26.  * 4. The names "Apache" and "Apache Software Foundation" must
  27.  *    not be used to endorse or promote products derived from this
  28.  *    software without prior written permission. For written
  29.  *    permission, please contact apache@apache.org.
  30.  *
  31.  * 5. Products derived from this software may not be called "Apache",
  32.  *    nor may "Apache" appear in their name, without prior written
  33.  *    permission of the Apache Software Foundation.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  * ====================================================================
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Apache Software Foundation.  For more
  51.  * information on the Apache Software Foundation, please see
  52.  * <http://www.apache.org/>.
  53.  *
  54.  * Portions of this software are based upon public domain software
  55.  * originally written at the National Center for Supercomputing Applications,
  56.  * University of Illinois, Urbana-Champaign.
  57.  */
  58.  
  59. #ifndef APACHE_UTIL_SCRIPT_H
  60. #define APACHE_UTIL_SCRIPT_H
  61.  
  62. #include "apr_buckets.h"
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67.  
  68. /**
  69.  * @package Apache script tools
  70.  */
  71.  
  72. #ifndef APACHE_ARG_MAX
  73. #ifdef _POSIX_ARG_MAX
  74. #define APACHE_ARG_MAX _POSIX_ARG_MAX
  75. #else
  76. #define APACHE_ARG_MAX 512
  77. #endif
  78. #endif
  79.  
  80. /**
  81.  * Create an environment variable out of an Apache table of key-value pairs
  82.  * @param p pool to allocate out of
  83.  * @param t Apache table of key-value pairs
  84.  * @return An array containing the same key-value pairs suitable for
  85.  *         use with an exec call.
  86.  * @deffunc char **ap_create_environment(apr_pool_t *p, apr_table_t *t)
  87.  */
  88. AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t);
  89.  
  90. /**
  91.  * This "cute" little function comes about because the path info on
  92.  * filenames and URLs aren't always the same. So we take the two,
  93.  * and find as much of the two that match as possible.
  94.  * @param uri The uri we are currently parsing
  95.  * @param path_info The current path info
  96.  * @return The length of the path info
  97.  * @deffunc int ap_fine_path_info(const char *uri, const char *path_info)
  98.  */
  99. AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info);
  100.  
  101. /**
  102.  * Add CGI environment variables required by HTTP/1.1 to the request's 
  103.  * environment table
  104.  * @param r the current request
  105.  * @deffunc void ap_add_cgi_vars(request_rec *r)
  106.  */
  107. AP_DECLARE(void) ap_add_cgi_vars(request_rec *r);
  108.  
  109. /**
  110.  * Add common CGI environment variables to the requests environment table
  111.  * @param r The current request
  112.  * @deffunc void ap_add_common_vars(request_rec *r)
  113.  */
  114. AP_DECLARE(void) ap_add_common_vars(request_rec *r);
  115.  
  116. /**
  117.  * Read headers output from a script, ensuring that the output is valid.  If
  118.  * the output is valid, then the headers are added to the headers out of the
  119.  * current request
  120.  * @param r The current request
  121.  * @param f The file to read from
  122.  * @param buffer Empty when calling the function.  On output, if there was an
  123.  *               error, the string that cause the error is stored here. 
  124.  * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
  125.  * @deffunc int ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer)
  126.  */ 
  127. AP_DECLARE(int) ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer);
  128.  
  129. /**
  130.  * Read headers output from a script, ensuring that the output is valid.  If
  131.  * the output is valid, then the headers are added to the headers out of the
  132.  * current request
  133.  * @param r The current request
  134.  * @param bb The brigade from which to read
  135.  * @param buffer Empty when calling the function.  On output, if there was an
  136.  *               error, the string that cause the error is stored here. 
  137.  * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
  138.  * @deffunc int ap_scan_script_header_err_brigade(request_rec *r, apr_bucket_brigade *bb, char *buffer)
  139.  */ 
  140. AP_DECLARE(int) ap_scan_script_header_err_brigade(request_rec *r,
  141.                                                   apr_bucket_brigade *bb,
  142.                                                   char *buffer);
  143.  
  144. /**
  145.  * Read headers strings from a script, ensuring that the output is valid.  If
  146.  * the output is valid, then the headers are added to the headers out of the
  147.  * current request
  148.  * @param r The current request
  149.  * @param buffer Empty when calling the function.  On output, if there was an
  150.  *               error, the string that cause the error is stored here. 
  151.  * @param termch Pointer to the last character parsed.
  152.  * @param termarg Pointer to an int to capture the last argument parsed.
  153.  * @param args   String arguments to parse consecutively for headers, 
  154.  *               a NULL argument terminates the list.
  155.  * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
  156.  * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data)
  157.  */ 
  158. AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, 
  159.                                                       char *buffer, 
  160.                                                       const char **termch,
  161.                                                       int *termarg, ...);
  162.  
  163. /**
  164.  * Read headers output from a script, ensuring that the output is valid.  If
  165.  * the output is valid, then the headers are added to the headers out of the
  166.  * current request
  167.  * @param r The current request
  168.  * @param buffer Empty when calling the function.  On output, if there was an
  169.  *               error, the string that cause the error is stored here. 
  170.  * @param getsfunc Function to read the headers from.  This function should
  171.                    act like gets()
  172.  * @param getsfunc_data The place to read from
  173.  * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
  174.  * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data)
  175.  */ 
  176. AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
  177.                        int (*getsfunc) (char *, int, void *),
  178.                        void *getsfunc_data);
  179.  
  180. #ifdef __cplusplus
  181. }
  182. #endif
  183.  
  184. #endif    /* !APACHE_UTIL_SCRIPT_H */
  185.